package org.test.client.ui.component.btn;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.plaf.basic.BasicButtonUI;

public class TopBlueBtn extends JButton{
	
	private static Color rollOver = new Color(Integer.parseInt("178acc", 16));
	
	private int pw = 0;
	private int ph = 0;
    private 	BufferedImage icon;
    private String txt = null;
    
    private TopBlueBtn thisBtn = this;
    
	public TopBlueBtn(String txt ,Color hoverColor, int pw, int ph,BufferedImage icon) {
		super();
		if(hoverColor != null){
			this.rollOver = hoverColor;
		}
		this.pw = pw;
		this.ph = ph;
		this.icon = icon;
		this.txt = txt;
		doInit();
	}
	
	public TopBlueBtn(String txt ,int pw, int ph,BufferedImage icon) {
		this(txt,null,pw,ph,icon);
	}
	
	
	public void doInit(){
		this.setUI(new BasicButtonUI());
		this.setBorder(null);
		this.setMargin(null);
		this.setOpaque(false);
		this.setRequestFocusEnabled(false);
		this.setBackground(null);
		this.setContentAreaFilled(false);
		if(icon != null){
			this.setIcon(new ImageIcon(icon));
		}
		this.setFont(new Font(Font.DIALOG,Font.PLAIN,14));
		this.setForeground(Color.WHITE);
		
		this.setText(txt);
		this.setPreferredSize(new Dimension(pw,ph));
		
		this.addMouseListener(new MouseInListener(this,rollOver));
	}
	
}
